package com.ruoyi.app.service.impl;

import com.ruoyi.app.domain.Department;
import com.ruoyi.app.domain.DepartmentSmall;
import com.ruoyi.app.mapper.DepartmentMapper;
import com.ruoyi.app.mapper.DepartmentSmallMapper;
import com.ruoyi.app.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 75460
* @description 针对表【department(k科室表)】的数据库操作Service实现
* @createDate 2025-05-15 15:31:01
*/
@Service
public class DepartmentServiceImpl implements DepartmentService{

    @Autowired
    private DepartmentMapper departmentMapper;
    @Autowired
    private DepartmentSmallMapper departmentSmallMapper;
    @Override
    public Department getById(Integer departmentId) {
        return departmentMapper.getById(departmentId);
    }

    @Override
    public List<Department> getlist(Integer hospitalId) {
        List<Department> getlist = departmentMapper.getlist(hospitalId);
        for (Department department : getlist) {
            department.setSubs(departmentSmallMapper.getlist(department.getId()));
        }
        return getlist;
    }
}




